/**
 * 
 */
package com.axxc.jpa.entity;

import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.springframework.beans.BeanUtils;

import com.axxc.jpa.out.Developer;
import com.axxc.jpa.out.model.VisitLog;

/**
 * @ClassName: AccessLogEntity
 * @Description: TODO(这里用一句话描述这个类的作用)
 * @author 熊小川
 * @date 2018年6月6日 下午9:45:33
 * @See
 */
@Entity
@Table(name = "t_log")
public class VisitLogEntity extends Developer {
	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue
	private Long id;
	private String visitUrl;
	private String visitHttpMethod;
	private String visitIp;
//	第一种：@Temporal(TemporalType.DATE)——》实体类会封装成日期“yyyy-MM-dd”的 Date类型。
//
//	第二种：@Temporal(TemporalType.TIME)——》实体类会封装成时间“hh-MM-ss”的 Date类型。
//
//	第三种：@Temporal(TemporalType.TIMESTAMP)——》实体类会封装成完整的时间“yyyy-MM-dd hh:MM:ss”的 Date类型。
	@Temporal(TemporalType.TIMESTAMP)
	private Date visitDate;
	private String visitMethod;
	@Lob
	@Column(columnDefinition = "text")
	@Basic(fetch = FetchType.LAZY)
	private String visitArg;

	@Lob
	@Column(columnDefinition = "text")
	@Basic(fetch = FetchType.LAZY)
	private String responseJson;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getVisitUrl() {
		return visitUrl;
	}

	public void setVisitUrl(String visitUrl) {
		this.visitUrl = visitUrl;
	}

	public String getVisitHttpMethod() {
		return visitHttpMethod;
	}

	public void setVisitHttpMethod(String visitHttpMethod) {
		this.visitHttpMethod = visitHttpMethod;
	}

	public String getVisitIp() {
		return visitIp;
	}

	public void setVisitIp(String visitIp) {
		this.visitIp = visitIp;
	}


	public Date getVisitDate() {
		return visitDate;
	}

	public void setVisitDate(Date visitDate) {
		this.visitDate = visitDate;
	}

	public String getVisitMethod() {
		return visitMethod;
	}

	public void setVisitMethod(String visitMethod) {
		this.visitMethod = visitMethod;
	}

	public String getVisitArg() {
		return visitArg;
	}

	public void setVisitArg(String visitArg) {
		this.visitArg = visitArg;
	}

	public String getResponseJson() {
		return responseJson;
	}

	public void setResponseJson(String responseJson) {
		this.responseJson = responseJson;
	}

	public VisitLog toModel() {
		VisitLog target = new VisitLog();
		BeanUtils.copyProperties(this, target);
		return target;
	};
}
